<SCRIPT LANGUAGE="JavaScript">  
    function validation()
    {
        var temp="";
        var alpha = /^[a-zA-Z0-9-_]*$/;
        var emailPattern = /^\w+@\w+(\.\w{2,3})+(\.\w{2,3})?$/;
        
        temp=document.getElementById('EmployerUsername');
        if( temp.value.length < 6 || temp.value.length > 20 || !alpha.test(temp.value))
        {
            temp.focus();
            temp.style.backgroundColor='#FFC';
            alert('Username must be between 6 to 20 alphanumeric characters');
            temp.style.backgroundColor='#FFF';
            return false;             
        }

        temp=document.getElementById('EmployerPassword');
        if( temp.value.length < 6 || temp.value.length > 20 || !alpha.test(temp.value))
        {
            temp.focus();
            temp.style.backgroundColor='#FFC';
            alert('Password must be between 6 to 20 alphanumeric characters');
            temp.style.backgroundColor='#FFF';
            return false;             
        }
        
        if( temp.value!=document.getElementById('EmployerPassword2').value )
        {
            document.getElementById('EmployerPassword2').focus();
            document.getElementById('EmployerPassword2').style.backgroundColor='#FFC';
            alert("Your Confirm Password doesn't match");
            document.getElementById('EmployerPassword2').style.backgroundColor='#FFF';
            return false;             
        }

        temp=document.getElementById('EmployerFullName');
        if( temp.value.length ==0 )
        {
            temp.focus();
            temp.style.backgroundColor='#FFC';
            alert('Please provide the name of the contact person');
            temp.style.backgroundColor='#FFF';
            return false;             
        }

        temp=document.getElementById('EmployerCpPhone');
        if( temp.value.length ==0 )
        {
            temp.focus();
            temp.style.backgroundColor='#FFC';
            alert('Please provide phone number of the contact person');
            temp.style.backgroundColor='#FFF';
            return false;             
        }

        temp=document.getElementById('EmployerCpEmail');
        if( !emailPattern.test(temp.value) )
        {
            temp.focus();
            temp.style.backgroundColor='#FFC';
            alert('Please enter a valid email for contact person');
            temp.style.backgroundColor='#FFF';
            return false;             
        }                
    
        temp=document.getElementById('EmployerCompanyName');
        if( temp.value.length ==0 )
        {
            temp.focus();
            temp.style.backgroundColor='#FFC';
            alert('Please provide the name of the company');
            temp.style.backgroundColor='#FFF';
            return false;             
        }
    
        temp=document.getElementById('EmployerLocation');
        if( temp.value.length ==0 )
        {
            temp.focus();
            temp.style.backgroundColor='#FFC';
            alert('Please provide the location of the company');
            temp.style.backgroundColor='#FFF';
            return false;             
        }    

        temp=document.getElementById('EmployerCityId');
        if( temp.value.length ==0 )
        {
            temp.focus();
            temp.style.backgroundColor='#FFC';
            alert('Please fill the city location of the company');
            temp.style.backgroundColor='#FFF';
            return false;             
        }  

        temp=document.getElementById('EmployerEmail');
        if( !emailPattern.test(temp.value) )
        {
            temp.focus();
            temp.style.backgroundColor='#FFC';
            alert('Please enter the valid email for the company profile');
            temp.style.backgroundColor='#FFF';
            return false;             
        }  
        temp=document.getElementById('EmployerSlip');
        if( temp.value=='' )
        {
            temp.focus();
            alert('Please provide the payment slip');
            return false;             
        }   
        
        temp=document.getElementById('security_code').value;
        if( temp != document.getElementById('security_code2').value)
        {
            document.getElementById('security_code').focus();
            document.getElementById('security_code').style.backgroundColor='#FFC';
            alert('Security code is not valid');
            document.getElementById('security_code').style.backgroundColor='#FFF';
            return false;             
        }        
        
    }        
        
        
</SCRIPT>

<?php 

echo "<div class='form'>";
echo "<h2> Employer Sign Up Form </h2>";
echo "<hr color='#2A7EF7'>";    
if(empty($sukses))
{

    $RandomStr = md5(microtime());// md5 to generate the random string
    $ResultStr = substr($RandomStr,0,5);//trim 5 digit
    $_SESSION['key']=$ResultStr;

    echo "<div class='kotak2'>";
    echo $form->create('Employer', array('action'=>'signup','type'=>'file','onsubmit'=>'return validation();'));
        echo "<div class='input'><label> &nbsp </label>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<span class='red'>*</span> <b>Required Field</b></div>";
		
        echo $form->input('username',array ('maxLength'=>'20','after'=>"<span class='red'><sup>*</sup></span>"));
        echo "<div class='result' id='result'></div>"; 
        echo $ajax->observeField('EmployerUsername', array(                
                                    'url' => array('controller'=> 'employers', 'action' => 'checkname'), 
                                    'update' => 'result','frequency' => 0.2)
                                    );        
        
        echo $form->input('password',array ('maxLength'=>'20','after'=>"<span class='red'><sup>*</sup></span>"));
        echo $form->input('password2',array ('label'=>'Confirm Password','type'=>'password','maxLength'=>'20','after'=>"<span class='red'><sup>*</sup></span>"));

        echo "<table cellspacing='8px'><tr><td><h3>Contact Person</h3></td><td width='400px'><hr color='#aaa'></td></tr></table>";
        echo $form->input('salution', array( 'empty'=>'', 'options'=>array('Mr.'=>'Mr.','Ms.'=>'Ms.','Mrs.'=>'Mrs.','Dr.'=>'Dr.') ) );
        echo $form->input('full_name',array ('maxLength'=>'40','after'=>"<span class='red'><sup>*</sup></span>"));
        echo $form->input('cp_phone',array ('label'=>'Phone Number', 'maxLength'=>'40','after'=>"<span class='red'><sup>*</sup></span>"));
        echo $form->input('cp_email',array ('label'=>'Email', 'maxLength'=>'40','after'=>"<span class='red'><sup>*</sup></span>"));
        
        echo "<table cellspacing='8px'><tr><td><h3>Company Profile</h3></td><td width='390px'><hr color='#aaa'></td></tr></table>";
        echo $form->input('company_name', array ('maxLength'=>'40', 'size'=>'40','after'=>"<span class='red'><sup>*</sup></span>"));
        echo $form->input('industry', array ('label'=>'Type of Industry'));
        echo $form->input('location',array ('label'=>'Detail Location', 'size'=>'40','after'=>"<span class='red'><sup>*</sup></span>"));
        echo $form->input('city_id',array( 'empty'=>'','after'=>"<span class='red'><sup>*</sup></span>" ));
        echo $form->input('fax', array ('maxLength'=>'20'));
        echo $form->input('website', array ('maxLength'=>'40','value'=>'http://'));
        echo $form->input('email', array ('maxLength'=>'40','after'=>"<span class='red'><sup>*</sup></span>"));
        echo "<br>";
        echo $form->input('slip',array('label'=>'Slip Payment','type'=>'file','after'=>"<span class='red'><sup>*</sup></span>"));
        
        echo "<br>";
        $baseurl = current(split("index", $_SERVER['PHP_SELF']));
        echo "<div class='input'><label>&nbsp</label><img src='".$baseurl."CaptchaSecurityImages.php?code=".$_SESSION['key']."'></div>";
        echo "<div class='input'><label>Security Code</label><input type='text' id='security_code' size=5><span class='red'><sup>*</sup></span></div><input type='hidden' id='security_code2' value='".$_SESSION['key']."'>";
        
        echo "<div class='input'><label> &nbsp </label><input type='submit' value='Submit'></div>";
    echo "</form>";
    echo "</div>"; 
    echo ":. <span class='info'> Contact person's email will be hidden from jobseekers </span>"; 
    echo "<br>:. <span class='info'> Company's email will be shown to jobseekers in company profile and adv jobs</span>"; 
    echo "<br>:. If you already have account on ITjobz.com. please login ";
    echo $html->link('[ Here ]',array('controller'=>'employers','action'=>'login'));    
}
else
{
    echo "If in 24 hours businness day you account hasn't been activate please contact us.";
}


echo "</div>";
?>

